use Test::More 'no_plan';

use lib "../lib/cpp", "../lib/ioc", "../lib/toolkit", '../lib/message';

use TinyMessage;
use Signature;

use CHeaderParser;
use CProject;
use CConstructorMatcher;
use CCodeGenerator;
use FindBin;

use IProject;
use IModule;
use IProvider;
use ICreator;

my $source = "$FindBin::Bin/cpp/test-ioc-1/";
my $out = $source . "generated";

my $iproject = new IProject();
$iproject->load(new CProject($source));

my @modules = @{ $iproject->modules() };

is (@modules, 1);

my $module = $modules[0];
my $moduleClasses = $module->moduleClasses();

is($moduleClasses->keys(), 1);

#ok($moduleClasses->exists('DIRECT< ConsoleLogService >'));
#ok($moduleClasses->exists('SINGLETON< ConsoleLogService >'));
#ok($moduleClasses->exists('ConsoleLogServiceProvider'));
ok($moduleClasses->exists('ConsoleLogService'));

my $creator = undef;

#{
#	$creator = $module->class_creator('DIRECT< ConsoleLogService >');
#	ok($creator);
#	is(signature($creator->class()->to_carg('*')), 'DIRECT< ConsoleLogService >*');
#	is(stringfy($creator->class()), 'DIRECT_lt_ConsoleLogService_gt_');
#	is($creator->ctor()->count(), 0);
#}

#{
#	$creator = $module->class_creator('SINGLETON< ConsoleLogService >');
#	ok($creator);
#	is(signature($creator->class()->to_carg('*')), 'SINGLETON< ConsoleLogService >*');
#	is(stringfy($creator->class()), 'SINGLETON_lt_ConsoleLogService_gt_');
#	is($creator->ctor()->count(), 0);
#}

#{
#	$creator = $module->class_creator('ConsoleLogServiceProvider');
#	ok($creator);
#	is(signature($creator->class()->to_carg('*')), 'ConsoleLogServiceProvider*');
#	is(stringfy($creator->class()), 'ConsoleLogServiceProvider');
#	is($creator->ctor()->count(), 0);
#}

{
	$creator = $module->class_creator('ConsoleLogService');
	ok($creator);
	is(signature($creator->class()->to_carg('*')), 'ConsoleLogService*');
	is(stringfy($creator->class()), 'ConsoleLogService');
	is($creator->ctor()->count(), 0);
}